package com.apobates.jforum2.troll.threads.entity;

import com.apobates.jforum2.troll.regular.ForumActionEnum;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 回复/话题举报类型
 * @author xiaofanku
 * @since 20200521
 */
public enum ForumReportTypeEnum {
    AD(1, "广告"),
    SEXY(2, "色情"),
    POLITIC(3, "政治"),
    VIOLENCE(4, "暴恐"),

    SCAM(7, "诈骗"),
    GAMBLE(8, "赌博"),
    VULGAR(9, "低俗"),
    DRM(10, "侵权"),

    ETC(6, "其它");
    
    private final int symbol;
    private final String title;
    
    private ForumReportTypeEnum(int symbol, String title) {
        this.symbol = symbol;
        this.title = title;
    }
    
    public int getSymbol() {
        return symbol;
    }
    
    public String getTitle() {
        return title;
    }
    
    public static Map<Integer,String> getData(){
        return Stream.of(ForumReportTypeEnum.values()).collect(Collectors.toMap(ForumReportTypeEnum::getSymbol, ForumReportTypeEnum::getTitle));
    }
    
    /**
     * ForumReportTypeEnum.symbol返回实例
     * @param symbol
     * @return 
     */
    public static Optional<ForumReportTypeEnum> getInstance(final int symbol){
        return Stream.of(ForumReportTypeEnum.values()).filter(fae->fae.getSymbol() == symbol).findFirst();
    }
}